Skip to content

chainreg: wait for a restarting node before calling a chain mismatch - #31

Open
Kilombino wants to merge 1 commit into
paulscode:blake2bfrom
Kilombino:chain-check-warmup
Open

Kilombino wants to merge 1 commit into
paulscode:blake2bfrom
Kilombino:chain-check-warmup

Conversation

@Kilombino

Copy link
Copy Markdown

The periodic chain-identity re-check shuts lnd down the first time the node fails to answer, even when the node is only restarting.

On our node the bitcoind is restarted after a block when the AirVPN exit IP changes (so it announces the new externalip). Today the restart landed on the 5-minute tick and lnd stopped with:

[CRT] CHRE: The Bitcoin node changed chains under a running daemon: the connected Bitcoin node is not on the Bitcoin BLAKE2b chain: the node cannot serve block 961640: -28: Loading P2P addresses…
[INF] CHRE: Sending request for shutdown

The node was back two seconds later; Docker restarted lnd, but every channel reconnected for nothing.

This tells a node that cannot answer (-28 RPC warm-up, connection refused/reset, EOF, other net.Error) from one that answers with another chain. The first is asked again every 15 s for up to 5 min before it counts as a mismatch; the second (wrong header, height out of range, any other RPC error) is still reported at once. The start-up check is unchanged.

Test: go test -race -run 'ChainIdentity|NodeUnreachable' ./chainreg/

The periodic chain-identity re-check shut lnd down the first time the
node failed to answer, even when the node was only restarting: a bitcoind
restart that lands on the 5-minute tick answers -28 (RPC warm-up) or
refuses the connection, and that was reported as "the connected Bitcoin
node is not on the Bitcoin BLAKE2b chain".

The re-check now tells a node that cannot answer (warm-up, connection
refused or dropped) from one that answers with another chain. The first
is asked again every 15 seconds for up to 5 minutes before it counts as a
mismatch; the second is still reported at once. The start-up check is
unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant